<template>
  <!-- 顶部导航栏 -->
  <van-nav-bar
    class="hmNavBar"
    @click-left="$router.push(path)"
    @click-right="rightEvent"
    fixed
  >
    <template #left v-if="icon">
      <i class="iconfont f44" v-html="icon"></i>
    </template>
    <template #title>
      <div class="title">
        {{ title }}
      </div>
    </template>
    <template #right>
      <div class="right iconfont" v-html="right"></div>
    </template>
  </van-nav-bar>
</template>

<script>
export default {
  name: 'HmNavBar',
  props: {
    // 中间标题
    title: {
      type: String
    },
    // 跳转路径
    path: {
      type: String
    },
    // 右边
    right: {
      type: String
    },
    // 左边,默认为左箭头
    icon: {
      type: String,
      default: '&#xe637;'
    }
  },
  methods: {
    // 右边点击事件
    rightEvent () {
      this.$emit('rightClick')
    }
  }
}
</script>

<style lang="less" scoped>
.hmNavBar {
  background-color: #3296fa;
  .f44 {
    color: #ffffff;
    font-size: 44px;
  }
  ::v-deep .van-nav-bar__left,
  ::v-deep .van-nav-bar__right {
    padding: 0;
  }
  .title {
    font-family: MicrosoftYaHei;
    font-size: 16px;
    font-weight: normal;
    font-stretch: normal;
    line-height: 18px;
    letter-spacing: 0px;
    color: #ffffff;
  }
  .right {
    margin-right: 15px;
    font-size: 14px;
    font-family: PingFangSC, PingFangSC-Regular;
    font-weight: 500;
    text-align: left;
    color: #ffffff;
    line-height: 20px;
    letter-spacing: 0px;
  }
}
</style>
